package org.baicaixiaozhan.learnsringbootvuedemo.controller;

import org.baicaixiaozhan.learnsringbootvuedemo.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author baicaixiaozhan
 * @since 2020/11/20
 */
@RestController
@RequestMapping("/api")
public class SimpleApiController {

    private final CategoryService categoryService;
    @Autowired
    public SimpleApiController(CategoryService categoryService) {
        this.categoryService = categoryService;
    }

    @GetMapping("/test1")
    public String firstSimpleApi() {
        return "Hello,World";
    }

    @GetMapping("/findAllCategory")
    public Object findAllCategoryList() {
        return categoryService.getAllList();
    }
}
